package competition;

import java.util.Scanner;

/**
 * @author ZhanBo
 * @date 2020/7/25
 */
public class MainC {

    public static void method(int [][] array ){
        for (int [] link : array){
            if (link[0] ==0 &&link[1]==0){
                System.out.println("YES");
            }else if ( link[0] == link[1]){
                System.out.println("NO");
            }else {
                isOK(link[0],link[1]);
            }
        }
    }

    public static boolean multiple(int a , int b){
        if (a*2==b || a == 2*b){
            return true;
        }else {
            return false;
        }
    }

    public static void isOK(int a , int b ){
        int  x  = b%a+1;
        while (x!=0) {
            if (multiple((a-x),(b-2*x))){
                a = a-x;
                b = b-2*x;
                x = Math.min(a,b);
                if (a ==0 && b == 0){
                    System.out.println("YSE");
                    return;
                }
            }else if (multiple((a-2*x),(b-x))){
               a = a-2*x;
               b = b-x;
                x = Math.min(a,b);
                if (a ==0 && b == 0){
                    System.out.println("YSE");
                    return;
                }
            }else {
                x--;
            }
        }
        System.out.println("NO");
    }



    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        while (scanner.hasNext()){
            int n =scanner.nextInt();
            int [][] array = new int[n][2];
            for (int i = 0 ; i <array.length;i++){
                array[i][0] = scanner.nextInt();
                array[i][1] = scanner.nextInt();
            }
            method(array);
        }
    }
}
